//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   testLocalProblemDiff2d.cc
 * \author Jeremy Roberts
 * \date   11/24/2010
 * \brief  test of ResponseFunction
 * \note   Copyright (C) 2010 Jeremy Roberts
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date:: 2010-11-08 20:29:53 -0500 (Mon, 08 Nov 2010) $:Date of last commit
//---------------------------------------------------------------------------//

#include <iostream>
#include "../Serment.hh"
#include "../LinAlg.hh"
using namespace std;
//---------------------------------------------------------------------------//

int main(int argc, char *args[])
{
    // initialize petsc
    PetscInitialize(&argc,&args,PETSC_NULL,PETSC_NULL);

    cout << " ---------------------------------- " << endl;
    cout << " --  test of LocalProblemDiff2d  -- " << endl;
    cout << " ---------------------------------- " << endl;
	// test of LocalProblemDiff2d
    // -- create a very small test problem and build response functions
    // -- then test by placing in ResponseMatrixFull

    string file = "local.inp";
    LocalProblemDiff2d lp( file );

    // create a BAIJ matrix
    integer g  = 1;
    integer os = 1;
    integer oa = 0;
    integer nf = 4; 
    integer ne = 2;
    integer *ee = new integer[2];
    ee[0] = 0; ee[1] = 1; 

    integer m = g*(1+os)*(1+oa)*nf * ne; // 1[group]2[orders]*4[sides]*2[elements]
    integer n = 1;                      // nonzero block per row (and # blocks being added)
    integer b = g*(1+os)*(1+oa)*nf;      // blocksize = 2[orders]*4[sides]

    ResponseFunctionServer *s = new ResponseFunctionServer( lp );

    ResponseMatrixFull R( g, os, oa, nf, ne, ee, s, m, m, n, b );
    FissionResponse    F( m, g, os, oa, nf, ne, ee, s );
    AbsorptionResponse A( m, g, os, oa, nf, ne, ee, s );
    integer *mmi=NULL, *mmj=NULL, mmn=0, numBlocks = g*(os+1)*(oa+1);
    integer numRows = ne*4;
    integer numCols = ne*4*numBlocks;
    LeakageResponse    L( g, os, oa, nf, ne, ee, s, numRows, numCols, numBlocks, nf, mmi, mmj, mmn );

    R.updateMat( 1.00 );
    R.viewMe();
    F.updateVec( 1.00 );
    F.viewMe();
    A.updateVec( 1.00 );
    A.viewMe();
    L.updateMat( 1.00 );
    L.viewMe();

	PetscFinalize();

	cout << "  ... all finished. now check for errors! " << endl;

    return 0;
}

//---------------------------------------------------------------------------//
//                 end of testLocalProblemDiff2d.cc
//---------------------------------------------------------------------------//

